package com.shycloud.mido.task.api.feign;


import com.shycloud.mido.common.core.constant.SecurityConstants;
import com.shycloud.mido.common.core.constant.ServiceNameConstants;
import com.shycloud.mido.common.core.util.R;
import com.shycloud.mido.task.api.dto.FavoriteTeacherDTO;
import com.shycloud.mido.task.api.dto.MemberLoginInfo;
import com.shycloud.mido.task.api.dto.MemberRoleDTO;
import com.shycloud.mido.task.api.entity.Member;
import com.shycloud.mido.task.api.entity.Teacher;
import com.shycloud.mido.task.api.vo.MemberDetailVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * @author npc
 * @date 2018/6/22
 */
@FeignClient(value = ServiceNameConstants.MEMBER_SERVICE)
public interface RemoteMemberService {
	/**
	 * 通过用户名查询用户、角色信息
	 *
	 * @param username username
	 * @param from     调用标志
	 * @return R
	 */
	@GetMapping("/v1/mobile/info/{username}")
	R<MemberLoginInfo> info(@PathVariable("username") String username
			, @RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 根据type@code查询用户
	 *
	 * @param inStr appid@code
	 * @param from  调用标志
	 * @return R
	 */
	@GetMapping("/v1/mobile/load/{inStr}")
	R<MemberLoginInfo> load(@PathVariable("inStr") String inStr
			, @RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 获取用户信息
	 *
	 * @param userid 会员id
	 * @return R
	 */
	@PostMapping("/member/memberInfo/{userid}")
    Member memberInfo(@PathVariable("userid") String userid);

	/**
	 * 通过手机号获取用户信息
	 *
	 * @param phone 会员手机号
	 * @return R
	 */
	@PostMapping("/member/memberInfoByPhone/{phone}")
    Member memberInfoByPhone(@PathVariable("phone") String phone);

	/**
	 * 学生收藏教师详情
	 *
	 * @param memberId 教师ID
	 * @return
	 */
	@PostMapping("/teacher/favoriteTeacher")
    FavoriteTeacherDTO favoriteTeacher(@RequestParam("memberId") String memberId);

	/**
	 * 获取教师信息
	 *
	 * @param memberId 会员id
	 * @return R
	 */
	@PostMapping("/teacher/teacherInfo/{memberId}")
    Teacher teacherInfo(@PathVariable("memberId") String memberId);

	/**
	 * 注册会员
	 *
	 * @param member 会员信息
	 * @return R
	 */
	@PostMapping(value = "/member/saveMember", consumes = "application/json")
	R saveMember(@RequestBody Member member);

	/**
	 * 获取指定身份的会员ID
	 *
	 * @param type 身份标示
	 * @return List<String>
	 */
	@GetMapping("/member/memberList/{type}")
	List<String> memberIdList(@PathVariable("type") String type,@RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 管理平台注册会员
	 *
	 * @param memberDetailVO 会员信息
	 * @return R
	 */
	@PostMapping("/member/adminSaveMember")
	String adminSaveMember(@RequestBody MemberDetailVO memberDetailVO);

	/**
	 * 管理平台更新会员密码
	 * @param memberId 会员ID
	 * @param pwd  密码
	 * @return
	 */
	@PostMapping("/member/updPwd")
	Boolean updPwd(@RequestParam("memberId") String memberId,@RequestParam("pwd") String pwd);

	/**
	 * 会员活跃积分操作
	 *
	 * @param code     策略code
	 * @param memberId 会员id
	 * @return
	 */
	@PostMapping("/activePoints")
	void activePoints(@RequestParam("code")String code,@RequestParam("memberId") String memberId);

	/**
	 *  更新会员个推会员标识
	 * @param memberId 会员ID
	 * @param clientId 个推会员标识
	 */
	@PostMapping("/member/updClientId")
	 void updClientId(@RequestParam("memberId")String memberId,@RequestParam("clientId")String clientId);

	/**
	 * 通过id查询关联家长信息
	 *
	 * @param id id
	 * @return R
	 */
	@PostMapping("/v1/mobile/getParent/{id}")
	List<Member> getParent(@PathVariable("id")  String id);

	/**
	 * 离会员到期1个月
	 * 离会员到期7天
	 * 离会员到期3天
	 * de 所有会员
	 * @return
	 */
	@PostMapping("/v1/mobile/roleExpire")
	List<MemberRoleDTO> roleExpire();

	/**
	 * 获取用户信息
	 *
	 * @param userid 会员id
	 * @return R
	 */
	@PostMapping("/member/memberInfo/{userid}")
    Member memberInfo(@PathVariable("userid") String userid, @RequestHeader(SecurityConstants.FROM) String from);

}
